using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._NetworkAnalystTools._Analysis
{
    /// <summary>
    /// <para>Add Locations</para>
    /// <para>Adds input features or records to a network analysis layer. The inputs are added to specific sublayers such as stops and barriers.</para>
    /// <para>将输入要素或记录添加到网络分析图层。输入被添加到特定的子层，例如挡块和障碍物。</para>
    /// </summary>    
    [DisplayName("Add Locations")]
    public class AddLocations : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public AddLocations()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_network_analysis_layer">
        /// <para>Input Network Analysis Layer</para>
        /// <para>The network analysis layer to which the network analysis objects will be added.</para>
        /// <para>将添加网络分析对象的网络分析图层。</para>
        /// </param>
        /// <param name="_sub_layer">
        /// <para>Sub Layer</para>
        /// <para>The name of the sublayer of the network analysis layer to which the network analysis objects will be added.</para>
        /// <para>网络分析图层的子图层的名称，网络分析对象将添加到该图层中。</para>
        /// </param>
        /// <param name="_in_table">
        /// <para>Input Locations</para>
        /// <para>The feature class or table containing the locations to be added to the network analysis sublayer.</para>
        /// <para>包含要添加到网络分析子图层的位置的要素类或表。</para>
        /// </param>
        public AddLocations(object _in_network_analysis_layer, object _sub_layer, object _in_table)
        {
            this._in_network_analysis_layer = _in_network_analysis_layer;
            this._sub_layer = _sub_layer;
            this._in_table = _in_table;
        }
        public override string ToolboxName => "Network Analyst Tools";

        public override string ToolName => "Add Locations";

        public override string CallName => "na.AddLocations";

        public override List<string> AcceptEnvironments => ["workspace"];

        public override object[] ParameterInfo => [_in_network_analysis_layer, _sub_layer, _in_table, _field_mappings, _search_tolerance, _sort_field, _search_criteria, _match_type.GetGPValue(), _append.GetGPValue(), _snap_to_position_along_network.GetGPValue(), _snap_offset, _exclude_restricted_elements.GetGPValue(), _search_query, _output_layer];

        /// <summary>
        /// <para>Input Network Analysis Layer</para>
        /// <para>The network analysis layer to which the network analysis objects will be added.</para>
        /// <para>将添加网络分析对象的网络分析图层。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Network Analysis Layer")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_network_analysis_layer { get; set; }


        /// <summary>
        /// <para>Sub Layer</para>
        /// <para>The name of the sublayer of the network analysis layer to which the network analysis objects will be added.</para>
        /// <para>网络分析图层的子图层的名称，网络分析对象将添加到该图层中。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Sub Layer")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _sub_layer { get; set; }


        /// <summary>
        /// <para>Input Locations</para>
        /// <para>The feature class or table containing the locations to be added to the network analysis sublayer.</para>
        /// <para>包含要添加到网络分析子图层的位置的要素类或表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Locations")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_table { get; set; }


        /// <summary>
        /// <para>Field Mappings</para>
        /// <para><xdoc>
        ///   <para>The mapping between the input fields of the network analysis sublayer to which you're adding locations and the fields in your input data or specified constants.</para>
        ///   <para>Input sublayers of network analysis layers have a set of input fields that you can modify or populate according to the needs of your analysis. When adding locations to the sublayer, you can use this parameter to map field values from your input table to these fields in the sublayer. You can also use field mappings to specify a constant default value for each property.</para>
        ///   <para>If neither the Field value nor the Default value is specified for a property, the resulting network analysis objects will have null values for that property.</para>
        ///   <para>A complete list of input fields for each sublayer for each network analysis layer type is available in the documentation for each layer. For example, examine the Route layer's Stops sublayer's input fields.</para>
        ///   <para>If the data you are loading contains network locations or location ranges based on the network dataset used for the analysis, choose the Use Network Location Fields option from the drop-down menu. Adding the network analysis objects using the network location fields is quicker than loading by geometry.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要向其添加位置的网络分析子图层的输入字段与输入数据或指定常量中的字段之间的映射。</para>
        ///   <para>网络分析图层的输入子图层具有一组输入字段，您可以根据分析的需要修改或填充这些输入字段。向子图层添加位置时，可以使用此参数将输入表中的字段值映射到子图层中的这些字段。您还可以使用字段映射为每个属性指定一个常量默认值。</para>
        ///   <para>如果未为属性指定字段值和默认值，则生成的网络分析对象将具有该属性的空值。</para>
        ///   <para>每个图层的文档中提供了每个网络分析图层类型的每个子图层的完整输入字段列表。例如，检查 Route 图层的 Stops 子图层的输入字段。</para>
        ///   <para>如果要加载的数据包含基于用于分析的网络数据集的网络位置或位置范围，请从下拉菜单中选择使用网络位置字段选项。使用网络位置字段添加网络分析对象比按几何加载更快。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Field Mappings")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _field_mappings { get; set; } = null;


        /// <summary>
        /// <para>Search Tolerance</para>
        /// <para><xdoc>
        ///   <para>The search tolerance that will be used to locate the input features on the network. Features that are outside the search tolerance are left unlocated. The parameter includes a value and units for the tolerance.</para>
        ///   <para>The default is 5000 meters.</para>
        ///   <para>The parameter is not used when adding locations to sublayers with line or polygon geometry, such as Line Barriers and Polygon Barriers.</para>
        ///   <para>This parameter is not used when the input network analysis layer's network data source is a portal service.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将用于在网络上定位输入要素的搜索容差。超出搜索容差范围的要素将处于未定位状态。该参数包括公差的值和单位。</para>
        ///   <para>默认值为 5000 米。</para>
        ///   <para>向具有线或面几何的子图层添加位置时，例如线屏障和面屏障，不使用该参数。</para>
        ///   <para>当输入网络分析图层的网络数据源为门户服务时，不使用此参数。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Search Tolerance")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public string? _search_tolerance { get; set; } = null;


        /// <summary>
        /// <para>Sort Field</para>
        /// <para>The field on which the network analysis objects are sorted as they are added to the network analysis layer. The default is the ObjectID field in the input feature class or the table.</para>
        /// <para>将网络分析对象添加到网络分析图层时对其进行排序的字段。默认值为输入要素类或表中的 ObjectID 字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Sort Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _sort_field { get; set; } = null;


        /// <summary>
        /// <para>Search Criteria</para>
        /// <para><xdoc>
        ///   <para>The sources in the network dataset that will be searched when calculating network locations and the portions of geometry (also known as snap types) that will be used. For example, if the network dataset references separate feature classes representing streets and sidewalks, you can choose to locate inputs on streets but not on sidewalks.</para>
        ///   <para>The following are the available snap type choices for each network source:
        ///   <bulletList>
        ///     <bullet_item>SHAPE—The point will locate on the closest point of an element in this network source.  </bullet_item><para/>
        ///     <bullet_item>MIDDLE—The point will locate on the closest midpoint of an element in this network source.  </bullet_item><para/>
        ///     <bullet_item>END—The point will locate on the closest endpoint of an element in this network source.  </bullet_item><para/>
        ///     <bullet_item>NONE—The point will not locate on elements in this network source.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        ///   <para>The MIDDLE and END options are maintained for backward compatibility. Use the SHAPE option to locate your inputs on a particular network source; otherwise, use NONE.</para>
        ///   <para>When calculating locations for line or polygon features, only the SHAPE snap type is used, even if other snap types are specified.</para>
        ///   <para>The default value is SHAPE for all network sources except override junctions created by running the Dissolve Network tool and system junctions, which have a default of NONE.</para>
        ///   <para>This parameter is not used when the network data source is a portal service.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>计算网络位置时将搜索的网络数据集中的源以及将使用的几何部分（也称为捕捉类型）。例如，如果网络数据集引用了表示街道和人行道的单独要素类，则可以选择在街道上定位输入，但不在人行道上定位输入。</para>
        /// <para>以下是每个网络源的可用快照类型选项：
        ///   <bulletList>
        ///     <bullet_item>SHAPE—该点将位于此网络源中元素的最近点上。</bullet_item><para/>
        ///     <bullet_item>MIDDLE—该点将位于此网络源中元素的最近中点。</bullet_item><para/>
        ///     <bullet_item>END - 该点将位于此网络源中元素的最近端点上。</bullet_item><para/>
        ///     <bullet_item>NONE—该点不会位于此网络源中的元素上。</bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        ///   <para>保留 MIDDLE 和 END 选项以实现向后兼容性。使用 SHAPE 选项在特定网络源上查找输入;否则，请使用 NONE。</para>
        ///   <para>计算线要素或面要素的位置时，即使指定了其他捕捉类型，也仅使用 SHAPE 捕捉类型。</para>
        ///   <para>所有网络源的默认值均为 SHAPE，但运行“融合网络”工具创建的覆盖联结和系统联结除外，默认值为 NONE。</para>
        ///   <para>当网络数据源是门户服务时，不使用此参数。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Search Criteria")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _search_criteria { get; set; } = null;


        /// <summary>
        /// <para>Find Closest among All Classes</para>
        /// <para>This parameter is only available via Python.</para>
        /// <para>此参数仅通过 Python 提供。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Find Closest among All Classes")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _match_type_value _match_type { get; set; } = _match_type_value._true;

        public enum _match_type_value
        {
            /// <summary>
            /// <para>MATCH_TO_CLOSEST</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("MATCH_TO_CLOSEST")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>PRIORITY</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("PRIORITY")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Append to Existing Locations</para>
        /// <para><xdoc>
        ///   <para>Specifies whether new network analysis objects will be appended to existing objects.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—The new network analysis objects will be appended to the existing set of objects in the selected sublayer. This is the default.</bullet_item><para/>
        ///     <bullet_item>Unchecked—The existing network analysis objects will be deleted and replaced with the new objects.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定是否将新的网络分析对象追加到现有对象。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 新的网络分析对象将追加到所选子图层中的现有对象集。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>未选中 - 将删除现有网络分析对象并将其替换为新对象。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Append to Existing Locations")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _append_value _append { get; set; } = _append_value._true;

        public enum _append_value
        {
            /// <summary>
            /// <para>APPEND</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("APPEND")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>CLEAR</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("CLEAR")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Snap to Network</para>
        /// <para><xdoc>
        ///   <para>Specifies whether the inputs will be snapped to their calculated network locations or will be represented at their original geographic location.</para>
        ///   <para>To use curb approach in your analysis to control which side of the road a vehicle must use to approach a location, do not snap the inputs to their network locations, or use a snap offset to ensure that the point remains clearly to one side of the road.</para>
        ///   <para>The parameter is not used when adding locations to sublayers with line or polygon geometry, such as Line Barriers and Polygon Barriers.</para>
        ///   <para>This parameter is not used when the input network analysis layer's network data source is a portal service.</para>
        ///   <para>If, after adding locations, you change the network analysis layer's travel mode or add or remove barriers, the network locations of affected points are automatically recalculated at solve time to ensure that they remain valid. This automatic recalculation process will not consider any settings, such as search queries, used previously when calculating network locations. Instead, it uses only the geometry of the input feature and the network analysis layer's travel mode and barriers. To make it more likely that the same network locations will be chosen if the point's network locations are automatically recalculated, use this parameter to snap the inputs to the network locations calculated while running this tool. In this way, the desired network location will be preserved in the geometry of the input point.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—The geometries of the network locations will be snapped to their network locations.</bullet_item><para/>
        ///     <bullet_item>Unchecked—The geometries of the network locations will be based on the geometries of the input features. This is the default.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定是将输入捕捉到其计算的网络位置，还是以原始地理位置表示。</para>
        ///   <para>要在分析中使用路缘方法来控制车辆必须使用道路的哪一侧来接近某个位置，请不要将输入捕捉到其网络位置，或者使用捕捉到偏移来确保该点清楚地保持在道路的一侧。</para>
        ///   <para>向具有线或面几何的子图层添加位置时，例如线屏障和面屏障，不使用该参数。</para>
        ///   <para>当输入网络分析图层的网络数据源为门户服务时，不使用此参数。</para>
        ///   <para>如果在添加位置后更改网络分析图层的出行模式或添加或移除障碍，则在求解时会自动重新计算受影响点的网络位置，以确保其仍然有效。此自动重新计算过程将不考虑以前在计算网络位置时使用的任何设置，例如搜索查询。相反，它仅使用输入要素的几何以及网络分析图层的出行模式和障碍。要使在自动重新计算点的网络位置时更有可能选择相同的网络位置，请使用此参数将输入捕捉到运行此工具时计算的网络位置。这样，所需的网络位置将保留在输入点的几何形状中。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 网络位置的几何将捕捉到其网络位置。</bullet_item><para/>
        ///     <bullet_item>未选中—网络位置的几何将基于输入要素的几何。这是默认设置。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Snap to Network")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _snap_to_position_along_network_value _snap_to_position_along_network { get; set; } = _snap_to_position_along_network_value._false;

        public enum _snap_to_position_along_network_value
        {
            /// <summary>
            /// <para>SNAP</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("SNAP")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NO_SNAP</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NO_SNAP")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Snap Offset</para>
        /// <para><xdoc>
        ///   <para>When snapping a point to the network, you can apply an offset distance. An offset distance of zero means the point will be coincident with the network feature (typically a line). To offset the point from the network feature, enter an offset distance. The offset is in relation to the original point location; that is, if the original point was on the left side, its new location will be offset to the left. If it was originally on the right side, its new location will be offset to the right.</para>
        ///   <para>The default is 5 meters. However, this parameter is ignored if Snap to Network is unchecked.</para>
        ///   <para>The parameter is not used when adding locations to sublayers with line or polygon geometry, such as Line Barriers and Polygon Barriers.</para>
        ///   <para>This parameter is not used when the input network analysis layer's network data source is a portal service.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将点捕捉到网络时，可以应用偏移距离。偏移距离为零表示该点将与网络要素（通常为线）重合。要从网络要素偏移点，请输入偏移距离。偏移量与原始点位置相关;也就是说，如果原始点位于左侧，则其新位置将偏移到左侧。如果它最初位于右侧，则其新位置将向右偏移。</para>
        ///   <para>默认值为 5 米。但是，如果未选中“对齐到网络”，则忽略此参数。</para>
        ///   <para>向具有线或面几何的子图层添加位置时，例如线屏障和面屏障，不使用该参数。</para>
        ///   <para>当输入网络分析图层的网络数据源为门户服务时，不使用此参数。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Snap Offset")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public string _snap_offset { get; set; } = "5 Meters";


        /// <summary>
        /// <para>Exclude Restricted Portions of the Network</para>
        /// <para>This parameter is only available via Python.</para>
        /// <para>此参数仅通过 Python 提供。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Exclude Restricted Portions of the Network")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _exclude_restricted_elements_value _exclude_restricted_elements { get; set; } = _exclude_restricted_elements_value._true;

        public enum _exclude_restricted_elements_value
        {
            /// <summary>
            /// <para>EXCLUDE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("EXCLUDE")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>INCLUDE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("INCLUDE")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Search Query</para>
        /// <para><xdoc>
        ///   <para>Defines a query that will restrict the search to a subset of the features in a source feature class. This is useful if you don't want to locate on features that may be unsuitable for your analysis. For example, you can use the query to exclude all features with a particular road class.</para>
        ///   <para>A separate SQL expression can be specified per source feature class of the network dataset. By default, no query is used for any source.</para>
        ///   <para>This parameter is not used when the network data source is a portal service.</para>
        ///   <para>The SQL expression for a given network source is specified by selecting the source name in the Name column and using the SQL expression builder in the Query column. For more information on SQL syntax, see SQL reference for query expressions used in ArcGIS.</para>
        ///   <para>Any network source not explicitly specified in the tool dialog box will have no query applied.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>定义一个查询，该查询将搜索限制为源要素类中要素的子集。如果您不想查找可能不适合分析的要素，这将非常有用。例如，您可以使用查询排除具有特定道路类的所有要素。</para>
        ///   <para>可以为网络数据集的每个源要素类指定单独的 SQL 表达式。默认情况下，不对任何源使用查询。</para>
        ///   <para>当网络数据源是门户服务时，不使用此参数。</para>
        ///   <para>通过在“名称”列中选择源名称，然后在“查询”列中使用 SQL 表达式生成器来指定给定网络源的 SQL 表达式。有关 SQL 语法的详细信息，请参阅 ArcGIS 中使用的查询表达式的 SQL 参考。</para>
        ///   <para>任何未在工具对话框中显式指定的网络源都不会应用查询。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Search Query")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _search_query { get; set; } = null;


        /// <summary>
        /// <para>Updated Input Network Analysis Layer</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Updated Input Network Analysis Layer")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _output_layer { get; set; }


        public AddLocations SetEnv(object workspace = null)
        {
            base.SetEnv(workspace: workspace);
            return this;
        }

    }

}